<template>
  <div class="companyC">
    <div class="companyC_title" @click="showDetails=!showDetails">
      {{ currentData.name }}
    </div>
    <div class="companyC_close" @click="$emit('close')"></div>
    <div class="companyC_position" v-if="showDetails">
      {{ currentData.position }}
    </div>
    <div v-show= "showDetails" style="display: flex;flex-direction: row;align-items: center"
         v-for="(item,index) in currentData.d "
         :key="index">
      <div class="companyC_icon">
      </div>
      <div class="companyC_address">
        {{ item }}
      </div>
    </div>
  </div>
</template>

<script>

// 公司详情弹窗

import companyJson from "@/assets/json/companyJson.json"

export default {
  name: "companyDialog",
  props: {
    companyId: String,//架构数据
  },
  mounted() {
    this.companyData.forEach(item => {
      if (item.id == this.companyId) {
        this.currentData = item
      }
    })
  },
  data() {
    return {
      showDetails: false,//展示详情
      companyData: companyJson,//公司数据
      currentData: '',
    }
  },
  methods: {}
}
</script>

<style lang="scss">
.userFlex {
  scrollbar-width: none; /* firefox */
  -ms-overflow-style: none; /* IE 10+ */
  overflow-y: auto;
}

.userFlex::-webkit-scrollbar {
  display: none; /* Chrome Safari */
}

.companyC {
  width: 400px;
  left: 50%;
  display: flex;
  transform: translate(-50%);
  position: absolute;
  top: 200px;
  background-color: rgba(8, 32, 72, 0.3);
  flex-direction: column;


  &_close {
    position: absolute;
    right: 10px;
    cursor: pointer;
    top: 10px;
    width: 23px;
    height: 22px;
    background-size: 100% 100%;
    background-image: url("@/assets/news/icon_closenews.png");
  }


  &_title {
    padding: 10px 0px;
    width: 100%;
    text-align: center;
    font-size: 17px;
    font-family: AdobeHeitiStd-Regular-, AdobeHeitiStd-Regular;
    font-weight: normal;
    color: #FFFFFF;
    cursor: pointer;
    background-size: 100% 100%;
    background-image: url("@/assets/bg_title1.png");
  }

  &_position {
    margin: 10px 20px;
    font-size: 12px;
    font-family: PingFang-SC-Regular-, PingFang-SC-Regular;
    font-weight: normal;
    color: #D8E8EC;
  }

  &_icon {
    width: 15px;
    margin-left: 20px;
    margin-right: 10px;
    height: 15px;
    background-size: 100% 100%;
    background-image: url("@/assets/icon_position.png");
  }

  &_address {
    height: 24px;
    font-size: 10px;
    font-family: PingFang-SC-Regular-, PingFang-SC-Regular;
    font-weight: normal;
    color: #D8E8EC;
    line-height: 24px;
  }
}

</style>